<?php 
	$myCartObj  = new Cart();
	$myCartInfo = $myCartObj->getMyCart();
	$siteConfig = new Config("site_config");
	$callback   = IReq::get('callback') ? urlencode(IFilter::act(IReq::get('callback'),'url')) : '';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><?php echo $siteConfig->name;?></title>
	<link type="image/x-icon" href="favicon.ico" rel="icon">
	<link rel="stylesheet" href="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/css/css.css";?>" />
	<link rel="stylesheet" href="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/css/hl.css";?>" />
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/jquery/jquery-1.11.3.min.js"></script><script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/jquery/jquery-migrate-1.2.1.min.js"></script>
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/form/form.js"></script>
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/autovalidate/validate.js"></script><link rel="stylesheet" type="text/css" href="/runtime/_systemjs/autovalidate/style.css" />
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artdialog/artDialog.js"></script><script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artdialog/plugins/iframeTools.js"></script><link rel="stylesheet" type="text/css" href="/runtime/_systemjs/artdialog/skins/default.css" />
	<script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artTemplate/artTemplate.js"></script><script type="text/javascript" charset="UTF-8" src="/runtime/_systemjs/artTemplate/artTemplate-plugin.js"></script>
	<script type='text/javascript' src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/common.js";?>"></script>	
	<script type='text/javascript' src='<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/site.js";?>'></script>
	<?php $sonline = new Sonline();$sonline->show($siteConfig->phone,$siteConfig->service_online);?>
</head>

<?php if(IWeb::$app->getController()->getId() == 'site' && IWeb::$app->getController()->getAction()->getId() == 'index'){?>
<style>
#categorys-2013 .mc {
display: block;
}
#categorys-2013 .mt b {
display: none;
}
</style>
<?php }else{?>
<script type='text/javascript'>
jQuery(function()
{
	  $("#nav-2013 .categorys-2014").hover(function(){
	    $(this).addClass("hover");
	  },function(){
		 $(this).removeClass("hover");
	  });
});
</script>

<?php }?>

<body>
<!--shortcut-2013-->
<div id="shortcut-2013">
	<div class="w">
		<ul class="fl lh">
			
			
			<?php if($this->user){?>
			<li class="fore1" id="loginbar">您好，欢迎您来到<?php echo $siteConfig->name;?>购物！<span>
			<a href="<?php echo IUrl::creatUrl("/ucenter/index");?>">[个人中心]</a> 
			<a href="<?php echo IUrl::creatUrl("/simple/logout");?>" class="link-regist">[安全退出]</a></span>
			</li>
			<?php }else{?>
			
			<li class="fore1" id="loginbar">您好，欢迎您来到<?php echo $siteConfig->name;?>购物！<span>
			<a href="<?php echo IUrl::creatUrl("/simple/login?callback=".$callback."");?>">[登录]</a> 
			<a href="<?php echo IUrl::creatUrl("/simple/reg?callback=".$callback."");?>" class="link-regist">[免费注册]</a></span>
			</li>
			
			<?php }?>
			
			
		</ul>
		<ul class="fr lh">
			<li class="fore2 ld">				
				<a href="<?php echo IUrl::creatUrl("/simple/seller");?>">申请开店</a>
			</li>
			<li class="fore2 ld">
				<s></s>
				<a href="<?php echo IUrl::creatUrl("/seller/index");?>">商家管理</a>
			</li>
			
			<li class="fore2 ld">
				<s></s>
				<a href="<?php echo IUrl::creatUrl("/ucenter/index");?>">我的账户</a>
			</li>
			<li class="fore2 ld">
				<s></s>
				<a href="<?php echo IUrl::creatUrl("/ucenter/order");?>">我的订单</a>
			</li>
			<li class="fore2 ld">
				<s></s>
				<a href="<?php echo IUrl::creatUrl("/site/help_list");?>">使用帮助</a>
			</li>
			
			
			
		</ul>
		<span class="clr"></span>
	</div>
</div>
<!--shortcut-2013-->
<!--o-header-2013-->
<div class="o-header-2013">
	<!--header-2013-->
	<div id="header-2013" class="w">
		<!--logo-2013-->
		<div id="logo-2013" class="ld">
		<a href="<?php echo IUrl::creatUrl("/site/index");?>"><b></b>
		<img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/logo.gif";?>" width="270" height="60" >
		</a>
		</div>
		<!--logo-2013-->
		<!--search-2013-->
		<div id="search-2013">
			<div class="i-search ld">
				<div class="form">
				<form method='get' action='<?php echo IUrl::creatUrl("/");?>'>
					<input type='hidden' name='controller' value='site' />
					<input type='hidden' name='action' value='search_list' />
					<input type="text" class="text" name="word" value="输入关键字..."  autocomplete="off">
					<input type="submit" value="搜索" class="button" onclick="checkInput('word','输入关键字...');">
				</form>
				</div>

			
			</div>
			<div id="hotwords" clstag="homepage|keycount|home2013|03b"><strong>热门搜索：</strong>
			<?php foreach(Api::run('getKeywordList') as $key => $item){?>
			<?php $tmpWord = urlencode($item['word']);?>
			<a href="<?php echo IUrl::creatUrl("/site/search_list/word/".$tmpWord."");?>"><?php echo isset($item['word'])?$item['word']:"";?></a>
			<?php }?>
			</div>
		</div>
		<!--search-2013-->
		
		<!--my360buy-2013-->
		<div id="my360buy-2013">
			<dl class="" load="1">
				<dt class="ld"><s></s><a href="<?php echo IUrl::creatUrl("site/index");?>">用户中心</a><b></b></dt>
				<dd>
					<?php if($this->user){?>
					<?php }else{?>
						<div class="prompt"> 
						<span class="fl">
						您好，请<a href="<?php echo IUrl::creatUrl("/simple/login?callback=".$callback."");?>" >登录</a>
						</span>            
						<span class="fr"></span>        
						</div>
					<?php }?>
					<div class="uclist">                
						<ul class="fore1 fl">                    
						<li><a href="<?php echo IUrl::creatUrl("ucenter/order");?>">我的订单</a></li>              
						<li><a href="<?php echo IUrl::creatUrl("ucenter/redpacket");?>">我的代金券</a></li>              
						<li><a href="<?php echo IUrl::creatUrl("ucenter/complain");?>">站点见意</a></li>              
						<li><a href="<?php echo IUrl::creatUrl("ucenter/account_log");?>">账户余额</a></li>              
						</ul>   
						<ul class="fore2 fl">                    
						<li><a href="<?php echo IUrl::creatUrl("ucenter/integral");?>">我的积分</a></li>                
						<li><a href="<?php echo IUrl::creatUrl("ucenter/favorite");?>">我的收藏</a></li>                
						<li><a href="<?php echo IUrl::creatUrl("ucenter/message");?>">我的消息</a></li>                
						<li><a href="<?php echo IUrl::creatUrl("ucenter/info");?>">个人资料</a></li>                
						</ul>        
				    </div>
			    </dd>
			</dl>
		</div>
		<!--my360buy-2013-->
		<!--settleup-2013-->
		<div id="settleup-2013" >
			<dl class="">
				<dt class="ld"><s></s>
				<span class="shopping">
				<span id="shopping-amount" name="mycart_count"><?php echo isset($myCartInfo['count'])?$myCartInfo['count']:"";?></span></span>
				<a href="<?php echo IUrl::creatUrl("simple/cart");?>" id="settleup-url">去购物车结算</a> <b></b> 
				</dt>
				<dd id="div_mycart">
					
				</dd>
			</dl>
		</div>
		<!--settleup-2013-->
		
		
		
			<!--购物车模板 开始-->
			<script type='text/html' id='cartTemplete'>
				<%for(var item in goodsData){%>
				<%var data = goodsData[item]%>
				<ul id="site_cart_dd_<%=item%>">
				<li>
				<div class="p-img fl">
				<a href="<?php echo IUrl::creatUrl("/site/products/id/<%=data['goods_id']%>");?>" target="_blank">
				<img src="<?php echo IUrl::creatUrl("")."<%=data['img']%>";?>" width="50" height="50" alt=""></a>
				</div>
				<div class="p-name fl">
				<span>
				</span><a href="<?php echo IUrl::creatUrl("/site/products/id/<%=data['goods_id']%>");?>" title="<%=data['name']%>" target="_blank">
				<%=data['name']%>
				</a>
				</div>
				<div class="p-detail fr ar">
				<span class="p-price"><strong>￥<%=data['sell_price']%></strong>×<%=data['count']%></span><br>
				<a class="delete" onclick="removeCart('<?php echo IUrl::creatUrl("/simple/removeCart");?>','<%=data['id']%>','<%=data['type']%>');$('#site_cart_dd_<%=item%>').hide('slow');" href="javascript:void(0);">删除</a>
				</div>
				</li>
				</ul>
				<%}%>


				
				<%if(data){%>
					<div class="smb ar">共<b name="mycart_count"><%=goodsCount%></b>件商品　共计<strong name="mycart_sum">￥<%=goodsSum%></strong><br>
					<a href="<?php echo IUrl::creatUrl("simple/cart");?>" title="去购物车结算" id="btn-payforgoods">去购物车结算</a></div>
				<%}else{%>
				
					<div class="prompt">
						<div class="nogoods"><b></b>购物车中还没有商品，赶紧选购吧！</div>
					</div>
				<%}%>
		
			</script>
			<!--购物车模板 结束-->
		
	</div>
	<!--header-2013-->
	
	<div class="w">
		<div id="nav-2013">
			<div id="categorys-2013" class="categorys-2014">
				<div class="mt ld">
					<h2><a href="<?php echo IUrl::creatUrl("site/sitemap");?>" clstag="homepage|keycount|home2013|06a">全部商品分类<b></b></a></h2>
				</div>
				
				<div id="_JD_ALLSORT" class="mc">
				
					<?php foreach(Api::run('getCategoryListTop') as $key => $first){?>
					<div class="item fore1 ">  
						<span >
						<h3><a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/".$first['id']."");?>"><?php echo isset($first['name'])?$first['name']:"";?></a>
						</h3><s></s>
						</span> 
						<div class="i-mc" style="top: 3px;">
							<div class="subitem">
							<?php foreach(Api::run('getCategoryByParentid',array('#parent_id#',$first['id'])) as $key => $second){?>
								<dl class="fore1">                
								<dt>
								<a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/".$second['id']."");?>"><?php echo isset($second['name'])?$second['name']:"";?></a>
								</dt>                
								<dd>
								<?php foreach(Api::run('getCategoryByParentid',array('#parent_id#',$second['id'])) as $key => $third){?>
									<em><a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/".$third['id']."");?>"><?php echo isset($third['name'])?$third['name']:"";?></a></em>
								<?php }?>
								</dd>          
								</dl>
								<?php }?>
							</div>
						</div>
					</div> 
					<?php }?>
					
					
				</div>
				
			</div>
			<ul id="navitems-2013">
				<li class="curr hover" ><a href="<?php echo IUrl::creatUrl("/site/index");?>">首页</a></li>
				<?php foreach(Api::run('getGuideList') as $key => $item){?>
				<li><a href="<?php echo IUrl::creatUrl("".$item['link']."");?>"><?php echo isset($item['name'])?$item['name']:"";?></a></li>
				<?php }?>
			</ul>
		</div>
	</div>
</div>
<!--o-header-2013-->

<?php 
	$site_config=new Config('site_config');
	$seo_data=array();
	$seo_data['title']=$site_config->name;
	$seo_data['title'].=$site_config->index_seo_title;
	$seo_data['keywords']=$site_config->index_seo_keywords;
	$seo_data['description']=$site_config->index_seo_description;
	seo::set($seo_data);
?>


<script type="text/javascript" src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/jquery.flexslider-min.js";?>"></script>
<div class="w">
	<!--o-slide-->
	<div id="o-slide">
		<!--幻灯片 开始-->

		 <div class="flexslider" >
		    <?php if($this->index_slide){?>
		    <ul class="slides">
		        <?php foreach($this->index_slide as $key => $item){?>
		        <li> <a href="<?php echo IUrl::creatUrl("".$item['url']."");?>" target="_blank"> <img src="<?php echo IUrl::creatUrl("")."".$item['img']."";?>" alt=""></a></li>
		        <?php }?>
		    </ul>
		    <?php }?>
		</div>
		
		<div class="jscroll">
			<?php echo Ad::show("首页幻灯片_下方1(220*159)");?>
			<?php echo Ad::show("首页幻灯片_下方2(220*159)");?>
			<?php echo Ad::show("首页幻灯片_下方3(220*159)");?>
		</div>
	</div>
	<!--o-slide-->
	
	<div class="m fr da0x70">
		<?php echo Ad::show("首页幻灯片_右1(310*70)");?>
	</div>
	<div id="jdnews" class="m m1">
		<div class="mt">
		<h2>网站公告</h2>
		<div class="extra"><a href="<?php echo IUrl::creatUrl("/site/notice");?>" target="_blank">更多公告&nbsp;&gt;</a></div>
		</div>
		<div class="mc">
		<ul>
		<?php foreach(Api::run('getAnnouncementList',10) as $key => $item){?>
		<?php $tmpId=$item['id'];?>
		<li  class="<?php if($key%2 ==0){?>odd<?php }?>"><a href="<?php echo IUrl::creatUrl("/site/notice_detail/id/".$tmpId."");?>"><?php echo isset($item['title'])?$item['title']:"";?></a></li>
		<?php }?>

	
		</ul>
		</div>
	</div>
	
	<div class="m fr da0x70" style="margin-top:10px;height:145px;">
		<?php echo Ad::show("首页幻灯片_右2(310*145)");?>
	</div>

	
</div>
<?php foreach(Api::run('getCategoryListTop') as $key => $first){?>
<div class="clear"></div>
<!--floors-list-->
<div id="floors-list" class="mt20">
	<div class="w w1">
		<!--catalogue-->
		<div class="catalogue m m1 ">
			<div class="mt ld">
			<div class="floor">
			<b class="fixpng b b1"></b><b class="fixpng b b2" style="height: 34px; display: block;"></b>
			<b class="b b3"><?php echo $key+1;?>F</b><b class="fixpng b4"></b></div>
			<h2 style="font-size:22px;"><?php echo isset($first['name'])?$first['name']:"";?></h2>
			</div>
			<div class="mc">
			<div class="style1">
			<ul class="lh">
			
			<?php foreach(Api::run('getCategoryByParentid',array('#parent_id#',$first['id'])) as $key => $second){?>
			<li><a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/".$second['id']."");?>"><?php echo isset($second['name'])?$second['name']:"";?></a></li>
			<?php }?>
			</ul>
			<span>
			<?php echo Ad::show("首页商品分类_左1(209*155)",$first['id']);?>
			</span>
			</div>
			</div>
		</div>
		<!--catalogue-->
		<!--m plist-->
		<Div class="m plist">
			<div class="hl_p_menu">
				<?php foreach(Api::run('getCategoryByParentid',array('#parent_id#',$first['id']),5) as $key => $second){?>
				<a href="javascript:void(0);" <?php if($key==0){?> class="cur" <?php }?>><?php echo isset($second['name'])?$second['name']:"";?>
					<div class="tab-arrow" style="left: 0px;"><b></b></div>
				</a>
				<?php }?>
				
			</div>
			<div class="clear"></div>
			<div class="hlsmc">
				
				<?php foreach(Api::run('getCategoryByParentid',array('#parent_id#',$first['id']),5) as $key => $second){?>
				<ul class="lh style3" style="<?php if($key>0){?>display:none;<?php }?>">
					<?php foreach(Api::run('getCategoryExtendList',array('#categroy_id#',$second['id']),10) as $key => $item){?>
					<li class="fore<?php echo $key+1;?>">            
						<div class="p-img ld"><a target="_blank" href="<?php echo IUrl::creatUrl("/site/products/id/".$item['id']."");?>" title="<?php echo isset($item['name'])?$item['name']:"";?>">
						<img height="100" width="100" alt="<?php echo isset($item['name'])?$item['name']:"";?>" src="<?php echo IUrl::creatUrl("/pic/thumb/img/".$item['img']."/w/100/h/100");?>"></a></div>            
						<div class="p-name">
							<a target="_blank" href="<?php echo IUrl::creatUrl("/site/products/id/".$item['id']."");?>" title="<?php echo isset($item['name'])?$item['name']:"";?>"><?php echo isset($item['name'])?$item['name']:"";?></a>
						</div>            
						<div class="p-price"><span>￥</span><?php echo isset($item['sell_price'])?$item['sell_price']:"";?></div>        
						</li>
					<?php }?>
				</ul>
				<?php }?>
			</div>
			
		</Div>
		<!--m plist-->
		
		<div class="sm sm1 pbrands">
			<div class="smt">
			<div class="extra">
			<a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/".$first['id']."");?>" target="_blank">更多>></a>
			</div>
			</div>
			
			<div class="smc">
			<ul class="lh">
				<?php $brand_list = Api::run('getBrandListByGoodsCategoryId',$first['id']);?>
	            <?php if($brand_list){?>
		           <?php foreach($brand_list as $key => $item){?>
					 <li><a href="<?php echo IUrl::creatUrl("/site/brand_zone/id/".$tmpId."");?>"><img height="35" width="98"  src="<?php echo IUrl::creatUrl("")."".$item['logo']."";?>" /></a></li>
					<?php }?>
				 <?php }?>
			</ul>
			</div>

			<div class="fr da209x180">
				<?php echo Ad::show("首页商品分类_右1(209*180)",$first['id']);?>
			</div>
		</div>
	
	</div>
</div>
<!--floors-list-->
<div class="clear"></div>
<?php }?>


<script type='text/javascript'>
//dom载入完毕执行
jQuery(function()
{
	//幻灯片开启

	$('.flexslider').flexslider(
	{
		animation: "slide",
		directionNav: false,
		animationLoop: false,
		controlNav: true,
		slideToStart: 0,
		slideshow: true,
		animationDuration: 300
	});

	$(".hl_p_menu a").hover(function(){
	$(this).addClass('cur').siblings().removeClass('cur');
	var p= $(this).index();
	$(this).parent().parent().children(".hlsmc").children("ul").eq(p).show().siblings().hide();

	});  


	  


	//email订阅 事件绑定

	//显示抢购倒计时
	var cd_timer = new countdown();
	<?php if(isset($countNumsItem) && $countNumsItem){?>
	<?php foreach($countNumsItem as $key => $item){?>
		cd_timer.add(<?php echo isset($item)?$item:"";?>);
	<?php }?>
	<?php }?>

	//首页商品变色
	var colorArray = ['green','yellow','purple'];
	$('div[name="showGoods"]').each(function(i)
	{
		$(this).addClass(colorArray[i%colorArray.length]);
	});
});

//电子邮件订阅
function orderinfo()
{
	var email = $('[name="orderinfo"]').val();
	if(email == '')
	{
		alert('请填写正确的email地址');
	}
	else
	{
		$.getJSON('<?php echo IUrl::creatUrl("/site/email_registry");?>',{email:email},function(content){
			if(content.isError == false)
			{
				alert('订阅成功');
				$('[name="orderinfo"]').val('');
			}
			else
				alert(content.message);
		});
	}
}


</script>


<div class="w">
	<div id="service-2013">
		
		
		<?php foreach(Api::run('getHelpCategoryFoot') as $key => $helpCat){?>
			<dl>
     			<dt><a href="<?php echo IUrl::creatUrl("/site/help_list/id/".$helpCat['id']."");?>"><?php echo isset($helpCat['name'])?$helpCat['name']:"";?></a></dt>
     			<dd>
				<?php foreach(Api::run('getHelpListByCatidAll',array('#cat_id#',$helpCat['id'])) as $key => $item){?>
					<div><a href="<?php echo IUrl::creatUrl("/site/help/id/".$item['id']."");?>"><?php echo isset($item['name'])?$item['name']:"";?></a></div>
				<?php }?>
				</dd>
      		</dl>
      		<?php }?>
      		
		<Div class="clear"></Div>

</div>
</div>


<div class="w">
	<div id="footer-2013">
		<?php echo IFilter::stripSlash($siteConfig->site_footer_code);?>
	</div>
</div>



<script type='text/javascript'>
$(function()
{
	
	
		  
	   $("#_JD_ALLSORT .item").hover(function(){
	    $(this).addClass("hover");
	  },function(){
		 $(this).removeClass("hover");
	  });
	  
	  
	  $("#my360buy-2013 dl").hover(function(){
	    $(this).addClass("hover");
	  },function(){
		 $(this).removeClass("hover");
	  });
	  	  

	  

	<?php $word = IReq::get('word') ? IFilter::act(IReq::get('word'),'text') : '输入关键字...'?>
	$('input:text[name="word"]').val("<?php echo isset($word)?$word:"";?>");

	$('input:text[name="word"]').bind({
		keyup:function(){autoComplete('<?php echo IUrl::creatUrl("/site/autoComplete");?>','<?php echo IUrl::creatUrl("/site/search_list/word/@word@");?>','<?php echo isset($siteConfig->auto_finish)?$siteConfig->auto_finish:"";?>');}
	});

	var mycartLateCall = new lateCall(200,function(){showCart('<?php echo IUrl::creatUrl("/simple/showCart");?>')});

	//购物车div层
	$('#settleup-2013 dl').hover(
		function(){
			$(this).addClass("hover");
			mycartLateCall.start();
		},
		function(){
			mycartLateCall.stop();
			 $(this).removeClass("hover");
			//$('#div_mycart').hide('slow');
		}
	);
});

//[ajax]加入购物车
function joinCart_ajax(id,type)
{
	$.getJSON("<?php echo IUrl::creatUrl("/simple/joinCart");?>",{"goods_id":id,"type":type,"random":Math.random()},function(content){
		if(content.isError == false)
		{
			var count = parseInt($('[name="mycart_count"]').html()) + 1;
			$('[name="mycart_count"]').html(count);
			$('.msgbox').hide();
			alert(content.message);
		}
		else
		{
			alert(content.message);
		}
	});
}

//列表页加入购物车统一接口
function joinCart_list(id)
{
	$.getJSON('<?php echo IUrl::creatUrl("/simple/getProducts");?>',{"id":id},function(content){
		if(!content)
		{
			joinCart_ajax(id,'goods');
		}
		else
		{
			var url = "<?php echo IUrl::creatUrl("/block/goods_list/goods_id/@goods_id@/type/radio/is_products/1");?>";
			url = url.replace('@goods_id@',id);
			artDialog.open(url,{
				id:'selectProduct',
				title:'选择货品到购物车',
				okVal:'加入购物车',
				ok:function(iframeWin, topWin)
				{
					var goodsList = $(iframeWin.document).find('input[name="id[]"]:checked');

					//添加选中的商品
					if(goodsList.length == 0)
					{
						alert('请选择要加入购物车的商品');
						return false;
					}
					var temp = $.parseJSON(goodsList.attr('data'));

					//执行处理回调
					joinCart_ajax(temp.product_id,'product');
					return true;
				}
			})
		}
	});
}
</script>
</body>
</html>
